package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.activity.wanyao.config.WanYaoConfig;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.wanyao.WanYaoMgr;

import java.util.ArrayList;
import java.util.List;

public class WanYaoRecycleStrategy extends AbstractItemRecycleStrategy  {
    @Override
    public void markNeedRecycleItem() {
        ActivityInfo activityInfo = WanYaoMgr.getActivityInfo();
        if (ActivityMgr.activityInShowTime(activityInfo)) {
            WanYaoConfig wanYaoConfig = WanYaoMgr.getConfig();
            if (wanYaoConfig != null) {
                int itemId = wanYaoConfig.getPowerItemId();
                int scoreItemId = wanYaoConfig.getScoreItemId();
                long recycleTime = activityInfo.getEndTime() * 1000L + gapTime;

                //标记体力道具
                List<String> paramList = new ArrayList<>();
                paramList.add(String.valueOf(itemId));
                paramList.add(String.valueOf(scoreItemId));
                paramList.add("2");
                paramList.add(activityInfo.getActivityName());

                ActivityItemRecycleMgr.addRecycleItemData(itemId, activityType, 1, recycleTime, paramList);
            }
        }
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.WanYao.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        item2Score(userId, data);
    }

    @Override
    public boolean isActivityRunning() {
        return false;
    }
}
